﻿@model WebEditor.Models.StringList

<div class="ui-widget-header ui-corner-all toolbar">
    @{
        string addId = "stringlist-" + Model.Attribute + "-add";
        string editId = "stringlist-" + Model.Attribute + "-edit";
        string deleteId = "stringlist-" + Model.Attribute + "-delete";
    }
    <button type="button" class="stringlist-add" id="@addId" data-key="@Model.Attribute" data-prompt="@Model.EditPrompt">Add</button>
    <button type="button" class="stringlist-edit" id="@editId" data-key="@Model.Attribute" data-prompt="@Model.EditPrompt">Edit</button>
    <button type="button" class="stringlist-delete" id="@deleteId" data-key="@Model.Attribute">Delete</button>
</div>

@{    
    string id = "select-" + Model.Attribute;  
}

<div>
    <select size="5" style="width: 100%" id="@id" class="stringlist" data-key="@Model.Attribute" data-prompt="@Model.EditPrompt">
        @if (Model.Items != null)
        {
            foreach (var item in Model.Items)
            {
                <option value="@item.Key">@item.Value</option>
            }
        }
    </select>
</div>
